# 1、书名
# 2、作者名
# 3、类型
# 4、更新时间
# 5、图片链接
import requests
from lxml import etree
url = 'http://book.zongheng.com/store.html'
response = requests.get(url)
print(response.status_code)
# print(response.text)
html = response.text
# xpath的使用
# 1、得到一个etree对象
ehtml = etree.HTML(html)
# 2、通过xpath查找
# 书名
xtitle = ehtml.xpath("//div[@class='bookname']/a/text()")
print(xtitle)
# 作者名
xtitle = ehtml.xpath("//div[@class='bookilnk']/a[1]/text()")
print(xtitle)
# 类型
xtitle = ehtml.xpath("//div[@class='bookilnk']/a[2]/text()")
print(xtitle)
# 更新时间
xtitle = ehtml.xpath("//div[@class='bookilnk']/span[2]/text()")
for i in xtitle:
    print(i[36:47])
# 图片链接
xtitle = ehtml.xpath("//div[@class='bookimg']/a//@src")
print(xtitle)
